package net.root.plain.main;

import net.root.plain.util.Common;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.TabHost;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;

@SuppressWarnings("deprecation")
public class MainActivity extends TabActivity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		TabHost.TabSpec spec;
		Intent intent;

		TabHost tabHost = getTabHost();
		Resources res = getResources();

		LayoutInflater.from(this).inflate(R.layout.activity_main,
				tabHost.getTabContentView(), true);

		// Tab1
		intent = new Intent().setClass(this, Tab1.class);
		spec = tabHost
				.newTabSpec(Common.tabName[0])
				.setIndicator(Common.tabName[0],
						res.getDrawable(R.drawable.ic_launcher))
				.setContent(intent);
		tabHost.addTab(spec);

		// Tab2
		intent = new Intent().setClass(this, Tab2.class);
		spec = tabHost
				.newTabSpec(Common.tabName[1])
				.setIndicator(Common.tabName[1],
						res.getDrawable(R.drawable.ic_launcher))
				.setContent(intent);
		tabHost.addTab(spec);

		// Tab3
		intent = new Intent().setClass(this, Tab3.class);
		spec = tabHost
				.newTabSpec(Common.tabName[2])
				.setIndicator(Common.tabName[2],
						res.getDrawable(R.drawable.ic_launcher))
				.setContent(intent);
		tabHost.addTab(spec);

		// Tab4
		intent = new Intent().setClass(this, Tab4.class);
		spec = tabHost
				.newTabSpec(Common.tabName[3])
				.setIndicator(Common.tabName[3],
						res.getDrawable(R.drawable.ic_launcher))
				.setContent(intent);
		tabHost.addTab(spec);
		tabHost.setCurrentTab(0);
		
	}

}
